﻿<Window x:Class="ICSharpCode.XamlDesigner.MainWindow"
        x:Name="root"
        xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sd="http://sharpdevelop.net"
        xmlns:AvalonDock="clr-namespace:AvalonDock;assembly=AvalonDock"
        xmlns:Outline="clr-namespace:ICSharpCode.WpfDesign.Designer.OutlineView;assembly=ICSharpCode.WpfDesign.Designer"
        xmlns:Default="clr-namespace:ICSharpCode.XamlDesigner"
        SnapsToDevicePixels="True"
        AllowDrop="True"
        Title="{Binding Title}">
	
	<Window.CommandBindings>
		
		<CommandBinding Command="New"
		                Executed="NewCommand_Executed" />
		
		<CommandBinding Command="Open"
		                Executed="OpenCommand_Executed" />
		
		<CommandBinding Command="Close"
		                Executed="CloseCommand_Executed"
		                CanExecute="CurrentDocument_CanExecute"
		                PreviewExecuted="CloseCommand_PreviewExecuted"/>
		
		<CommandBinding Command="Default:MainWindow.CloseAllCommand"
		                Executed="CloseAllCommand_Executed"
		                CanExecute="CurrentDocument_CanExecute" />
		
		<CommandBinding Command="Save"
		                Executed="SaveCommand_Executed"
		                CanExecute="CurrentDocument_CanExecute" />
		
		<CommandBinding Command="SaveAs"
		                Executed="SaveAsCommand_Executed"
		                CanExecute="CurrentDocument_CanExecute" />
		
		<CommandBinding Command="Default:MainWindow.SaveAllCommand"
		                Executed="SaveAllCommand_Executed"
		                CanExecute="CurrentDocument_CanExecute" />
		
		<CommandBinding Command="Default:MainWindow.ExitCommand"
		                Executed="ExitCommand_Executed" />
	
	</Window.CommandBindings>
	
	<DockPanel>
		
		<Menu DockPanel.Dock="Top">
			<MenuItem Header="File">
				<MenuItem Command="New" />
				<MenuItem Command="Open" />
				<Separator />
				<MenuItem Command="Close" />
				<MenuItem Command="Default:MainWindow.CloseAllCommand" />
				<Separator />
				<MenuItem Command="Save" />
				<MenuItem Command="SaveAs" />
				<MenuItem Command="Default:MainWindow.SaveAllCommand" />
				<Separator />
				<MenuItem Header="Recent Files"
				          ItemsSource="{Binding RecentFiles}"
				          IsEnabled="{Binding RecentFiles.Count, Converter={StaticResource FalseWhenZero}}"
				          Click="RecentFiles_Click"/>
				<Separator />
				<MenuItem Command="Default:MainWindow.ExitCommand" />
			</MenuItem>
			<MenuItem Header="Edit">
				<MenuItem Command="Undo" />
				<MenuItem Command="Redo" />
				<Separator />
				<MenuItem Command="Cut" />
				<MenuItem Command="Copy" />
				<MenuItem Command="Paste" />
				<MenuItem Command="Delete" />
				<MenuItem Command="SelectAll" />
				<Separator />
				<MenuItem Command="Default:MainWindow.RefreshCommand" />
				<MenuItem Command="Find" />
			</MenuItem>
		</Menu>
		
		<AvalonDock:DockingManager x:Name="uxDockingManager">
			<AvalonDock:ResizingPanel>
				
				<AvalonDock:DocumentPane x:Name="uxDocumentPane"
					SelectedValue="{Binding CurrentDocument}"
					SelectedValuePath="DataContext"/>
				
				<AvalonDock:DockablePane>
					<AvalonDock:DockableContent x:Name="content1" Title="Toolbox">
						<Default:ToolboxView />
					</AvalonDock:DockableContent>
				</AvalonDock:DockablePane>
				
				<AvalonDock:DockablePane>
					<AvalonDock:DockableContent x:Name="content2" Title="Outline">
						<Outline:Outline Root="{Binding CurrentDocument.OutlineRoot}"/>
					</AvalonDock:DockableContent>
				</AvalonDock:DockablePane>
				
				<AvalonDock:DockablePane>
					<AvalonDock:DockableContent x:Name="content3" Title="Errors">
						<Default:ErrorListView ItemsSource="{Binding CurrentDocument.XamlErrorService.Errors}"/>
					</AvalonDock:DockableContent>
				</AvalonDock:DockablePane>
				
				<AvalonDock:DockablePane>
					<AvalonDock:DockableContent x:Name="content4" Title="Properties">
						<sd:PropertyGridView x:Name="uxPropertyGridView"
							SelectedItems="{Binding DataContext.CurrentDocument.SelectionService.SelectedItems, ElementName=root, FallbackValue={x:Null}}"/>
					</AvalonDock:DockableContent>
				</AvalonDock:DockablePane>
			
			</AvalonDock:ResizingPanel>
		</AvalonDock:DockingManager>
	</DockPanel>
</Window>
